;;;###autoload
(defun yisp-insert-date ()
  "Insert the current date at the current position."
  (interactive)
  (let ((date-string (format-time-string "%Y-%m-%d")))
    (insert date-string)))

;;;###autoload
(defun yisp-insert-copying ()
  "Insert the copying information."
  (interactive)
  (let ((is-mode #'(lambda (mn) (equal (string-match mn mode-name) 0)))
 	(is-any-mode-of #'(lambda (&rest l)
			    (let ((result nil))
			      (while l
				(if (funcall is-mode (car l))
				    (progn (setq l nil) (setq result t))
				  (setq l (cdr l))))
			      result)))
        (cm-start "") ;; the first line of copying
        (cm "") ;; comment mark
        (cm-end "") ;; the last line of copying
        (copying-format "")
        (author-name "Zhan Xin-Ming (Duzy Chan)")
        (author-email "<duzy@duzy.info, duzy.chan@gmail.com>")
        )
    (cond
     ((funcall is-any-mode-of
	       "^CPerl" "^Perl" "^GNUmakefile" "^Makefile" "^makefile")
      (setq cm-start "")
      (setq cm "#")
      (setq cm-end "")
      (insert "#")
      t)
     ((funcall is-mode "^CPerl")
      (setq cm-start "#")
      (setq cm "#")
      (setq cm-end "#")
      t)
     ((funcall is-mode "^C\+\+")
      (setq cm-start "/**")
      (setq cm " *")
      (setq cm-end " **/")
      t)
     ((funcall is-mode "^Emacs-Lisp")
      (setq cm-start ";;;")
      (setq cm ";;")
      (setq cm-end ";;")
      t)
     (t nil))
    (setq copying-format
          (string-make-multibyte (concat
           cm-start "\n"
           cm "    Copyright %s DuzySoft.com, by %s\n"
           cm "    All rights reserved by %s\n"
           cm "    Email: %s\n"
           cm "\n"
           cm "    $Id$\n"
           cm "\n"
           cm-end "\n"
           "\n"
           )))
    (insert (format copying-format
                    (format-time-string "%Y-%m-%d")
                    author-name author-name author-email
		    ))))
